import java.util.Scanner;

/**
 * acm.sgu.ru 102
 * @author aleksandr
 *
 */
public class Problem102 {

	public static void main(String[] args) {
		new Problem102().solve();
	}

	private void solve() {
		Scanner sc = new Scanner(System.in);
		System.out.println(euler(sc.nextInt()));
	}

	private long euler(int N) {
		long ret = 1;
		for (int i = 2; i * i <= N; i++) {
			int k = 0;
			long mult = 1;
			while (N % i == 0) {
				k++;
				N /= i;
				mult *= i;
			}
			if (k > 0) {
				ret *= (i - 1);
				ret *= mult / i;
			}
		}
		if (N > 1) {
			ret *= (N - 1);
		}
		return ret;
	}

}
